package com.ymttest.database.sqlwapper.shenqisettlement;

import java.util.HashMap;
import java.util.List;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.shenqisettlement.UserAccountDetail;

public class UserAccountDetailWrapper {

	SqlManager manager;

    public UserAccountDetailWrapper() {
        manager = new SqlManager("shenqisettlement");
    }
    
    @SuppressWarnings("unchecked")
	public List<UserAccountDetail> selectByUserId(long userId) {
 
    	List<UserAccountDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.shenqisettlement.UserAccountDetailMapper.selectByUserId",
                        userId);
        manager.commit();
        
		if (result.size() == 0) {
			Logger.comment("UserAccountDetail没有数据");
		}
		
		return result;
    }
    
    @SuppressWarnings("unchecked")
	public UserAccountDetail selectByUserIdAndFeeType(long userId, int accountFeeType) {
    	
    	HashMap<String, Object> map = new HashMap<>();
    	
    	map.put("user_id", userId);
    	map.put("account_fee_type", accountFeeType);
    	
    	List<UserAccountDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.shenqisettlement.UserAccountDetailMapper.selectByUserIdAndFeeType",
                        map);
        manager.commit();
        
		if (result.size() == 0) {
			Logger.comment("UserAccountDetail没有数据");
		}
		
		return result.get(0);
    }
    
    @SuppressWarnings("unchecked")
	public List<UserAccountDetail> selectByUserIdAndBizId(long userId, String bizId) {
    	
    	HashMap<String, Object> map = new HashMap<>();
    	
    	map.put("user_id", userId);
    	map.put("biz_id", bizId);
    	
    	List<UserAccountDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.shenqisettlement.UserAccountDetailMapper.selectByUserIdAndBizId",
                        map);
        manager.commit();
        
		if (result.size() == 0) {
			Logger.comment("UserAccountDetail没有数据");
		}
		
		return result;
    }
    
    @SuppressWarnings("unchecked")
	public List<UserAccountDetail> selectByBizId(String bizId) {
 
    	List<UserAccountDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.shenqisettlement.UserAccountDetailMapper.selectByBizId",
                        bizId);
        manager.commit();
        
		if (result.size() == 0) {
			Logger.comment("UserAccountDetail没有数据");
		}
		
		return result;
    }
    
    public static void main(String[] args) {
    	
    	UserAccountDetailWrapper wrapper = new UserAccountDetailWrapper();
    	
    	System.out.println(wrapper.selectByBizId("autotestsEkPX1KZ2lvj8cWMoqb4").size());
    }
}
